package com.blog.enums;

/**
 * @author tangqj
 * @Description 状态枚举
 * @create 2020/3/10 15:57
 */
public enum StatusEnum {
    MSG_WAIT("等待审核",0),
    MSG_PASS("通过",1),
    MSG_NOPASS("不通过",2);
    private String name;
    private int code;
    StatusEnum(String name,int code){
        this.name = name;
        this.code = code;
    }
    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
    
    public static StatusEnum getByCode(int code) {
        for(StatusEnum pointEnum : StatusEnum.values()) {
            if(pointEnum.code == code) {
                return pointEnum;
            }
        }
        return null;
    }

    public static StatusEnum getEnumByName(String name) {
        for(StatusEnum pointEnum : StatusEnum.values()) {
            if(pointEnum.name.equals(name)) {
                return pointEnum;
            }
        }
        return null;
    }
    
}
